deserializeFromToml
Deserializes a config class from a TomlElement
Custom deserializer, powered by TomlKt. Deserialization focuses on validation and building a useful error message. Deserialization happens in two ways
EntrySerializer elements are deserialized with their custom
deserializeEntry
method"Raw" properties and fields are deserialized with the TomlKt by-class-type deserialization.
Configs are deserialized "in place". That is to say, the deserializer iterates over the relevant fields and properties of a pre-instantiated "default" config class. Each relevant field/property is filled in with the results of deserializing from the TomlElement at the matching TomlTable key. If for some reason there is a critical error, the initial config passed in, with whatever deserialization was successfully completed, will be returned as a fallback.
Should be called as a matched pair to serializeToToml. Ex: if ignoreNonSync
is false on one end, it needs to be false on the other.
Return
Returns a ValidationResult of ConfigContext and applicable error, containing the config and any flag information
Author
fzzyhmstrs
Since
0.2.0
Parameters
the config type. Can be any Non-Null type.
the config pre-deserialization
the TomlElement to deserialize from. Needs to be a TomlTable
a mutableList of strings the original caller of deserialization can use to print a detailed error log
default true. If false, elements with the NonSync annotation will be skipped. Use true to deserialize the entire config (ex: loading from file), use false for syncing (ex: initial sync server -> client)